home *** CD-ROM | disk | FTP | other *** search
- joptionbutton.tcl\n\nIntroduction\nThe\ joptionbutton.tcl\ library\ is\ distributed\ as\ part\ of\ the\ jstools\ package.\ \ It\ provides\ a\ button\ that\ pops\ up\ an\ option\ menu\ so\ your\ users\ can\ make\ a\ one¡of¡many\ choice.\ \ It's\ equivalent\ in\ functionality\ to\ a\ group\ of\ radio\ buttons,\ but\ a\ little\ easier\ to\ use\ and\ more\ sparing\ of\ screen\ real¡estate.\n\nThis\ document\ describes\ joptionbutton.tcl\ version\ 3.6/3.0.\n\nUsage\nAccessing\ the\ Library\nIn\ order\ to\ use\ the\ joptionbutton.tcl\ library,\ it\ (and\ any\ other\ libraries\ it\ depends\ on)\ must\ be\ in\ your\ Tcl\ auto_path,\ described\ in\ tclvars(n).\ \ Information\ about\ how\ to\ arrange\ that,\ and\ other\ conventions\ common\ to\ the\ jstools\ libraries,\ is\ in\ the\ Usage\ section\ \ of\ The\ jstools\ Libraries.\n\nCredits\ and\ Copyright\nAuthor\nJay\ Sekora\ \njs@bu.edu\nhttp://shore.net/~js/\n\nCopyright\nThe\ library\ is\ copyright\ ⌐\ 1992-1994\ by\ Jay\ Sekora,\ but\ may\ be\ freely\ copied\ and\ modified\ for\ non¡commercial\ purposes.\ \ (Please\ contact\ me\ if\ you\ want\ to\ use\ it\ for\ a\ commercial\ purpose,\ this\ may\ be\ OK\ under\ some\ circumstances.)\n\nOverview\nProcedure\nj:option\ -\ create\ option\ button\ with\ associated\ menu\nj:option:configure\ -\ set\ attributes\ of\ option\ button\nj:option:popup\ -\ pop\ up\ option\ button's\ menu\n\nj:alert\nUsage\n\tj:option\ w\ \[options\]\nArgument\n\tw\ is\ the\ name\ of\ the\ new\ option\ button\ to\ create\nOptions\n\t-font\ font\ \ (default\ {})\n\t-list\ list\ \ (default\ \"(none)\"\;\ not\ really\ optional)\n\t-width\ width\ \ (default\ 20)\n\t-current\ current\ \ (default\ first\ element\ of\ list)\nExample\n\ttoplevel\ .prefs\n\tj:option\ .prefs.colour\ -list\ {red\ yellow\ blue}\ \\\n\t\ \ -current\ \$PREFS(colour)\n\tpack\ .prefs.colour\n\tbind\ .prefs.ok\ {set\ PREFS(colour)\ \[.prefs.colour\ get\]}\n\t\nDescription\nThis\ procedure\ creates\ a\ new\ option\ button,\ w,\ with\ an\ associated\ menu,\ which\ can\ be\ posted\ by\ clicking\ on\ the\ button.\ \ An\ option\ button\ is\ useful\ for\ asking\ the\ user\ to\ select\ one\ option\ from\ a\ constrained\ set\ of\ choices.\ \ The\ menu\ will\ contain\ all\ the\ elements\ of\ list,\ and\ the\ button\ will\ be\ labelled\ with\ current.\ \ If\ current\ is\ not\ in\ list,\ it\ will\ be\ added\ to\ the\ beginning\ of\ list\ the\ first\ time\ the\ menu\ is\ brought\ up.\ \ Choosing\ another\ item\ from\ the\ menu\ will\ cause\ the\ button's\ text\ to\ change\ to\ that\ item,\ and\ cause\ the\ item\ to\ become\ the\ new\ current\ value\ of\ the\ option\ button.\ \ If\ font\ is\ specified\ and\ non¡null,\ both\ the\ button\ and\ the\ menu\ will\ be\ displayed\ in\ that\ font.\ \ The\ menu\ will\ be\ width\ characters\ wide,\ and\ the\ button\ will\ also\ be\ width\ characters\ wide\ unless\ it\ is\ packed\ in\ such\ a\ way\ as\ to\ change\ its\ dimensions.\n\nThe\ current\ value\ of\ the\ button\ can\ be\ manipulated\ with\ the\ get\ and\ set\ widget\ commands,\ and\ the\ current\ values\ of\ the\ widget\ options\ can\ be\ changed\ or\ retrieved\ with\ the\ configure\ widget\ command.\n\nWidget\ Commands\nw\ get\nThis\ widget\ command\ returns\ the\ current\ value\ of\ the\ option\ button.\n\nw\ set\ value\nThis\ widget\ command\ sets\ the\ current\ value\ of\ the\ option\ button.\n\nw\ configure\ option\ \[argument\]\nThis\ widget\ command\ lets\ you\ retrieve\ (if\ argument\ is\ omitted)\ or\ set\ (if\ it\ is\ provided)\ the\ current\ value\ of\ any\ of\ the\ options,\ font,\ list,\ width,\ or\ current.\n\nj:option:configure\nUsage\n\tj:option:configure\ w\ option\ \[argument\]\nArguments\n\tw\ is\ the\ pathname\ of\ the\ option\ button\ to\ be\ configured\n\toption\ is\ one\ of\ -font,\ -list,\ -current,\ or\ -width\n\targument,\ if\ specified,\ is\ the\ new\ value\ of\ option\n\nDescription\nThis\ procedure\ is\ used\ internally\ by\ j:option,\ and\ should\ not\ need\ to\ be\ called\ directly.\ \ It\ implements\ the\ configure\ widget\ command.\n\nj:option:popup\nUsage\n\tj:option:popup\ w\ button\nArguments\n\tw\ is\ the\ pathname\ of\ the\ frame\ to\ hold\ the\ popup\ menu\n\tbutton\ is\ the\ pathname\ of\ the\ option\ button\n\nDescription\nThis\ procedure\ is\ used\ internally\ by\ j:option,\ and\ should\ not\ need\ to\ be\ called\ directly.\ \ It\ is\ invoked\ when\ an\ option\ button\ is\ clicked\ on.\ \ It\ creates\ a\ new\ frame\ w,\ packs\ a\ listbox\ in\ it\ to\ simulate\ a\ menu,\ positions\ it\ appropriately\ over\ the\ option\ button,\ and\ sets\ up\ mouse\ bindings\ letting\ the\ user\ select\ an\ item\ from\ the\ listbox.\ \ (The\ reason\ for\ using\ a\ listbox\ rather\ than\ a\ menu\ is\ that\ the\ width\ of\ a\ menu\ can't\ be\ set.)\n\nEvolution\nFeel\ free\ to\ report\ bugs\ (and\ feature\ requests)\ to\ me,\ <js@bu.edu>,\ and\ I\ will\ try\ to\ deal\ with\ them.\ \ Also,\ feel\ free\ to\ fix\ bugs\ or\ add\ features\ on\ your\ own\ and\ let\ me\ know\ how\ you\ did\ it.\n\nBugs\ and\ Misfeatures\nIf\ an\ option\ button\ is\ packed\ such\ that\ it's\ larger\ or\ smaller\ than\ its\ requested\ width\ (as\ specified\ by\ the\ -width\ option),\ its\ menu\ will\ be\ the\ wrong\ size.\n\nOnly\ one\ option\ at\ a\ time\ can\ be\ specified\ to\ j:option:configure,\ and\ hence\ to\ the\ configure\ widget\ command.\n\nChanges\n*\ This\ library\ is\ new\ with\ version\ 3.6/3.0.\n\nFuture\ Directions\n*\ I'm\ probably\ going\ to\ rewrite\ this\ to\ be\ more\ compatible\ with\ the\ Tk\ 4.0\ tk_optionMenu\ procedure.\n {{{jdoc:xref:link {4.60 4.67 10.218 10.239 10.247 10.265 10.269 10.290 23.0 23.8 24.0 24.18 25.0 25.14}} {jdoc:xref:manpage {10.134 10.141 92.75 92.88}} {jdoc:anchor:anchorname {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 27.0 28.0 80.0 81.0}} {richtext:font:roman {2.0 3.0 4.0 4.4 4.21 4.60 4.67 4.301 5.0 6.24 6.41 8.0 9.21 10.20 10.37 10.110 10.119 10.134 10.141 10.222 10.229 10.251 10.256 10.269 10.290 12.0 14.0 15.0 15.9 16.0 16.21 17.0 19.0 21.0 23.8 24.0 24.18 25.0 25.14 27.0 29.12 29.13 29.20 29.21 31.0 31.1 31.2 32.0 33.0 33.1 33.13 33.22 33.24 34.1 34.13 34.23 34.29 35.1 35.15 35.24 35.26 36.1 36.19 37.0 43.0 44.0 45.0 45.44 45.45 45.266 45.270 45.309 45.316 45.322 45.329 45.340 45.344 45.383 45.387 45.594 45.598 45.705 45.710 45.756 45.761 47.60 47.63 47.68 47.71 47.171 47.180 47.196 48.0 49.0 50.5 53.0 53.11 56.0 56.19 56.20 56.28 57.42 57.50 57.131 57.135 57.137 57.141 57.143 57.148 57.153 57.160 59.0 61.0 61.1 61.29 61.30 61.38 62.0 63.0 63.1 63.2 64.1 64.7 64.18 64.23 64.25 64.30 64.32 64.40 64.45 64.51 65.1 65.9 65.45 65.51 67.0 68.0 68.37 68.45 68.109 68.118 70.0 72.24 73.0 74.0 74.1 74.2 75.1 75.7 77.0 78.0 78.37 78.45 78.166 78.167 80.0 81.0 81.55 81.66 83.0 84.0 84.109 84.115 86.46 86.64 86.83 86.92 88.0 88.7 91.0 91.17 92.75 92.88 93.0}} {richtext:font:italic {29.10 29.11 29.13 29.20 29.21 30.0 31.1 31.2 33.7 33.11 34.7 34.11 35.8 35.13 36.10 36.17 45.44 45.45 45.266 45.270 45.309 45.316 45.322 45.329 45.340 45.344 45.383 45.387 45.594 45.598 45.705 45.710 45.756 45.761 50.0 50.1 53.0 53.1 53.6 53.11 56.0 56.1 56.12 56.18 56.20 56.28 57.42 57.50 57.131 57.135 57.137 57.141 57.143 57.148 57.153 57.160 61.20 61.21 61.22 61.28 61.30 61.38 63.1 63.2 64.1 64.7 65.1 65.9 65.45 65.51 72.0 72.1 72.16 72.17 72.18 72.24 74.1 74.2 75.1 75.7 78.166 78.167}} {richtext:font:bold {4.4 4.21 4.60 4.67 4.301 5.0 6.24 6.41 10.20 10.37 10.222 10.229}} {richtext:font:bolditalic {10.251 10.256 10.269 10.290}} {richtext:font:typewriter {10.110 10.119 10.134 10.141 15.0 15.9 16.0 16.21 23.0 23.8 24.0 24.18 25.0 25.14 29.0 29.10 29.11 29.12 33.1 33.7 33.11 33.13 33.22 33.24 34.1 34.7 34.11 34.13 34.23 34.29 35.1 35.8 35.13 35.15 35.24 35.26 36.1 36.10 36.17 36.19 38.0 43.0 47.60 47.63 47.68 47.71 47.171 47.180 47.196 48.0 50.1 50.5 53.1 53.6 56.1 56.12 56.18 56.19 61.1 61.20 61.21 61.22 61.28 61.29 64.18 64.23 64.25 64.30 64.32 64.40 64.45 64.51 68.37 68.45 68.109 68.118 72.1 72.16 72.17 72.18 78.37 78.45 81.55 81.66 84.109 84.115 86.46 86.64 86.83 86.92 92.75 92.88}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 27.0 28.0 59.0 60.0 70.0 71.0 80.0 81.0}} {richtext:font:heading2 {9.0 9.21 13.0 14.0 17.0 19.0 22.0 23.0 28.0 29.0 30.0 31.0 32.0 33.0 37.0 38.0 44.0 45.0 49.0 50.0 60.0 61.0 62.0 63.0 67.0 68.0 71.0 72.0 73.0 74.0 77.0 78.0 83.0 84.0 88.0 88.7 91.0 91.17}} {{} {11.0 21.0 22.0 23.0 26.0 27.2 27.7 29.3 29.9 29.10 29.12 29.21 31.49 33.0 36.50 37.0 80.0 82.0 87.0 88.0 89.43 90.0}} {jdoc:link:jstools.jdoc {4.60 4.67}} {jdoc:manpage:tclvars {10.134 10.141}} {jdoc:link:jslibraries.jdoc#Usage {10.247 10.265}} {jdoc:link:jslibraries.jdoc {10.218 10.239 10.269 10.290}} {jdoc:anchorname:Evolution {80.0 81.0}} {jdoc:anchorname:Credits_and_Copyright {12.0 13.0}} {jdoc:anchorname:Introduction {3.0 4.0}} {jdoc:anchorname:Overview {21.0 22.0}} {{jdoc:section:j:alert } {23.0 23.2}} {jdoc:anchorname:j:alert {27.0 28.0}} {jdoc:link:#j:option {23.0 23.8}} {jdoc:link:#j:option:configure {24.0 24.18}} {jdoc:link:#j:option:popup {25.0 25.14}} {jdoc:manpage:optionMenu {92.75 92.88}} {jdoc:anchorname:Usage {8.0 9.0}}} {{abbrevstart 92.2} {matchend 68.88} {del_from 93.0} {richptr 93.0} {abbrevend 92.2} {insert 1.0} {emacs_mark 93.0} {anchor 4.9} {matchstart 68.80} {del_to 93.0} {current 10.136}}}